function [fig,ht] = fm_enter(upath,psatver,psatdate)
% FM_ENTER initial splash GUI
%
% FM_ENTER(PATH)
%     PATH current PSAT path
%
%Author:    Federico Milano
%Date:      11-Nov-2002
%Update:    29-Jul-2003
%Version:   1.0.1
%
%E-mail:    federico.milano@ucd.ie
%Web-site:  faraday1.ucd.ie/psat.html
%
% Copyright (C) 2002-2019 Federico Milano

global Settings

colori = [      0         0    1.0000;
                0    0.5000         0;
           1.0000         0         0;
                0    0.7500    0.7500;
           0.7500         0    0.7500;
           0.7500    0.7500         0;
           0.2500    0.2500    0.2500];

set(0,'Units','pixels')
scnsize = get(0,'ScreenSize');

if scnsize(3) > 1800
  xoffset = scnsize(3)/4;
else
  xoffset = 0;
end

if scnsize(4) > 1800
  yoffset = scnsize(4)/4;
else
  yoffset = 0;
end

pos = [(scnsize(3)-305)*0.5-xoffset, (scnsize(4)-390)*0.5-yoffset, 305, 390];

h0 = figure( ...
    'Color',[1 1 1], ...
    'Colormap',[], ...
    'MenuBar','none', ...
    'Name','', ...
    'NumberTitle','off', ...
    'PaperPosition',[18 180 576 432], ...
    'PaperType','A4', ...
    'PaperUnits','points', ...
    'Position',pos, ...
    'Resize','off', ...
    'ToolBar','none');
h1 = axes( ...
    'Parent',h0, ...
    'CameraUpVector',[0 1 0], ...
    'CameraUpVectorMode','manual', ...
    'Color',[1 1 1], ...
    'Layer','top', ...
    'Position',[0 0 1 1], ...
    'Tag','Axes1', ...
    'XColor',[1 1 1], ...
    'XLim',[0.5 346.5], ...
    'XLimMode','manual', ...
    'XTickLabelMode','manual', ...
    'XTickMode','manual', ...
    'YColor',[1 1 1], ...
    'YLim',[0.5 410.5], ...
    'YLimMode','manual', ...
    'YTickLabelMode','manual', ...
    'YTickMode','manual', ...
    'ZColor',[1 1 1]);

width = 346;
height = 410;
pic = [upath,filesep,'images',filesep,'misc_psat.bmp'];

if version < 8

  set(h1, 'YDir', 'reverse')

  h2 = image( ...
      'Parent',h1, ...
      'CData',imread(pic,'bmp'), ...
      'Tag','Axes1Image1', ...
      'XData',[1 width], ...
      'YData',[1 410]);

  ht = text(10,385,psatdate);
  set(ht, ...
      'Color',[0.85 0.2 0], ...
      'FontSize', 11, ...
      'FontWeight','bold', ...
      'FontName','Times', ...
      'HorizontalAlignment', 'left')


  h2 = text(width-10,385,['Version ',psatver]);
  set(h2, ...
      'Color',[0.85 0.2 0], ...
      'FontSize', 11, ...
      'HorizontalAlignment', 'right', ...
      'FontWeight','bold', ...
      'FontName','Times')

else

    h2 = image( ...
        'Parent',h1, ...
        'CData',flipud(imread(pic,'bmp')), ...
        'Tag','Axes1Image1', ...
        'XData',[1 width], ...
        'YData',[1 410]);

    ht = text(10,height-385,psatdate);
    set(ht, ...
        'Color',[0.85 0.2 0], ...
        'FontSize', 11, ...
        'FontWeight','bold', ...
        'FontName','Times', ...
        'HorizontalAlignment', 'left')

    h2 = text(width-10,height-385,['Version ',psatver]);
    set(h2, ...
        'Color',[0.85 0.2 0], ...
        'FontSize', 11, ...
        'HorizontalAlignment', 'right', ...
        'FontWeight','bold', ...
        'FontName','Times')

end
% set(h1, 'YDir', 'normal')

if nargout > 0, fig = h0; end
